home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
web
/
noweb
/
src
/
icon
/
icondefs.icn
< prev
next >
Wrap
Text File
|
1995-02-24
|
2KB
|
67 lines
#line 2 "icondefs.nw"
global showlocal
procedure main(args)
showlocal := !args == "-local"
go()
end
#line 8 "icondefs.nw"
procedure postpass(name, arg)
static kind, definers
initial { kind := "bogus"
definers := ["global"]
if \showlocal then every put(definers, "local" | "static")
}
case name of {
"begin" : arg ? kind := tab(upto(' ')|0)
"text" : if kind == "code" then arg ?
if =("procedure "|"record ") then {
tab(many(' '))
writedefn(tab(upto(' ()')))
} else if (tab(many(' ')) | "", =!definers, tab(many(' '))) then {
while (not any('#')) & writedefn(tab(upto(', #'))) do tab(many(', '))
if not any('#') then writedefn(tab(0))
}
}
return
end
procedure prepass(name, arg)
if name == "end" then writedefn(&null) # force newline
end
#line 1 "defns.nw"
procedure go()
local line
while line := read() do {
apply(prepass, line)
write(line)
apply(postpass, line)
}
end
procedure apply(pass, line)
line ? (="@" & pass(tab(upto(' ')|0), if =" " then tab(0) else &null))
end
#line 17 "defns.nw"
procedure writedefn(defn, locl)
static indextext
initial indextext := ""
if /defn then
*indextext > 0 &
#line 30 "defns.nw"
{ # write("@index nl") # don't!
indextext := ""
}
#line 22 "defns.nw"
else {
if *indextext + *defn > 65 then
#line 30 "defns.nw"
{ # write("@index nl") # don't!
indextext := ""
}
#line 24 "defns.nw"
write(if \locl then "@index localdefn" else "@index defn ", defn)
indextext ||:= " " || defn
}
return
end